package com.hsc.yalebao.tabChongZhi;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.handmark.pulltorefresh.library.ILoadingLayout;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnLastItemVisibleListener;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshBase.State;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.handmark.pulltorefresh.library.extras.SoundPullEventListener;
import com.hsc.yalebao.adapter.ZZZHListAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.GetZZZHlistBaseBean;
import com.hsc.yalebao.model.GetZZZHlistBean;
import com.hsc.yalebao.model.PayTypeBean;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.HashMap;
import okhttp3.Call;

public class GetZZZHlistActivity extends BaseActivity
{
  private String Ctype = "";
  private String TAG = "GetZZZHlistActivity";
  private ZZZHListAdapter adapter;
  private Context context;
  private View emptyView;
  private GridView gv_home;
  private int id = 0;
  private boolean isEnd = false;
  private boolean isRefesh = true;
  private ImageView iv_title_right;
  private ArrayList<GetZZZHlistBaseBean> list;
  private PayTypeBean mPayTypeBean;
  private PullToRefreshListView mPullRefreshListView;
  private int memberid;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
      }
      CustomApplication.app.finishActivity(GetZZZHlistActivity.this);
    }
  };
  private int page = 1;
  private ArrayList<GetZZZHlistBaseBean> result = new ArrayList();
  private String title = "选择微信账号";
  private View view_title;

  private void getzzzhList()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("memberid", this.memberid);
    localHashMap.put("page", this.page);
    localHashMap.put("Pagesize", "10");
    localHashMap.put("Ctype", this.Ctype);
    LogUtils.e(this.TAG, "getzzzhList(),page:" + this.page);
    LogUtils.e(this.TAG, " getzzzhList()   Ctype:" + this.Ctype);
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_ZZZHLIST);
    RequestNet.get(this.context, AppConstants.URL_GET_ZZZHLIST, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        GetZZZHlistActivity.this.mPullRefreshListView.onRefreshComplete();
        LogUtils.e(GetZZZHlistActivity.this.TAG, "获取失败,getzzzhList-result:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        GetZZZHlistActivity.this.mPullRefreshListView.onRefreshComplete();
        LogUtils.d(GetZZZHlistActivity.this.TAG, "result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
        {
          LogUtils.d(GetZZZHlistActivity.this.TAG, "result:" + paramAnonymousString);
          GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
        }
        GetZZZHlistBean localGetZZZHlistBean;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localGetZZZHlistBean = (GetZZZHlistBean)localGson.fromJson(paramAnonymousString, GetZZZHlistBean.class);
            if (localGetZZZHlistBean == null)
            {
              LogUtils.e(GetZZZHlistActivity.this.TAG, "getzzzhList == null，获取失败");
              GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localGetZZZHlistBean = null;
            }
            if (localGetZZZHlistBean.getFlag() == -4)
            {
              GetZZZHlistActivity.activityStack.backToMain(MainActivity.class, GetZZZHlistActivity.this.context);
              return;
            }
            if (localGetZZZHlistBean.getFlag() == 0)
            {
              LogUtils.e(GetZZZHlistActivity.this.TAG, "getzzzhList.getFlag() ！= 1   2");
              GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
              return;
            }
            if (localGetZZZHlistBean.getFlag() == -2)
            {
              GetZZZHlistActivity.this.showDownWireDialog();
              return;
            }
            if (localGetZZZHlistBean.getFlag() == -3)
            {
              GetZZZHlistActivity.this.ShowFengjinDialog();
              return;
            }
          }
        }
        while (localGetZZZHlistBean.getFlag() != 1);
        if (localGetZZZHlistBean.getResult() == null)
        {
          LogUtils.e(GetZZZHlistActivity.this.TAG, "getzzzhList.getResult() == null");
          return;
        }
        GetZZZHlistActivity.this.result.addAll(localGetZZZHlistBean.getResult());
        if ((GetZZZHlistActivity.this.result == null) || (GetZZZHlistActivity.this.result.size() == 0))
          GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
        if (localGetZZZHlistBean.getResult().size() < 10);
        for (GetZZZHlistActivity.this.isEnd = true; ; GetZZZHlistActivity.this.isEnd = false)
        {
          LogUtils.e(GetZZZHlistActivity.this.TAG, "page:" + GetZZZHlistActivity.this.page);
          LogUtils.e(GetZZZHlistActivity.this.TAG, "result.size():" + GetZZZHlistActivity.this.result.size());
          GetZZZHlistActivity.this.adapter.setData(GetZZZHlistActivity.this.result);
          GetZZZHlistActivity.this.adapter.notifyDataSetChanged();
          return;
        }
      }
    });
  }

  private void init()
  {
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    this.mPullRefreshListView = ((PullToRefreshListView)findViewById(2131099717));
    this.mPullRefreshListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        int i = paramAnonymousInt - 1;
        try
        {
          GetZZZHlistBaseBean localGetZZZHlistBaseBean = (GetZZZHlistBaseBean)GetZZZHlistActivity.this.result.get(i);
          if (GetZZZHlistActivity.this.Ctype.equals("1"))
          {
            Intent localIntent1 = new Intent(GetZZZHlistActivity.this, XianXiaYinhangActivity.class);
            localIntent1.putExtra("bean", localGetZZZHlistBaseBean);
            localIntent1.putExtra("id", GetZZZHlistActivity.this.id);
            localIntent1.putExtra("payTypeBean", GetZZZHlistActivity.this.mPayTypeBean);
            GetZZZHlistActivity.this.startActivity(localIntent1);
          }
          if (GetZZZHlistActivity.this.Ctype.equals("2"))
          {
            Intent localIntent2 = new Intent(GetZZZHlistActivity.this, XianXiaAliPayActivity.class);
            localIntent2.putExtra("bean", localGetZZZHlistBaseBean);
            localIntent2.putExtra("qrcode", localGetZZZHlistBaseBean.getQrcode());
            localIntent2.putExtra("id", GetZZZHlistActivity.this.id);
            localIntent2.putExtra("payTypeBean", GetZZZHlistActivity.this.mPayTypeBean);
            GetZZZHlistActivity.this.startActivity(localIntent2);
          }
          if (GetZZZHlistActivity.this.Ctype.equals("3"))
          {
            Intent localIntent3 = new Intent(GetZZZHlistActivity.this, XianXiaAliPayActivity.class);
            localIntent3.putExtra("bean", localGetZZZHlistBaseBean);
            String str = localGetZZZHlistBaseBean.getQrcode();
            localIntent3.putExtra("id", GetZZZHlistActivity.this.id);
            localIntent3.putExtra("qrcode", str);
            localIntent3.putExtra("payTypeBean", GetZZZHlistActivity.this.mPayTypeBean);
            GetZZZHlistActivity.this.startActivity(localIntent3);
          }
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    this.mPullRefreshListView.setMode(PullToRefreshBase.Mode.PULL_FROM_END);
    this.mPullRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener()
    {
      public void onRefresh(PullToRefreshBase<ListView> paramAnonymousPullToRefreshBase)
      {
        String str = DateUtils.formatDateTime(GetZZZHlistActivity.this.getApplicationContext(), System.currentTimeMillis(), 524305);
        paramAnonymousPullToRefreshBase.getLoadingLayoutProxy().setLastUpdatedLabel(str);
        if (GetZZZHlistActivity.this.mPullRefreshListView.isHeaderShown())
        {
          GetZZZHlistActivity.this.isRefesh = true;
          LogUtils.e(GetZZZHlistActivity.this.TAG, "mPullRefreshListView刷新");
          GetZZZHlistActivity.this.refeshgetzzzzhList();
          return;
        }
        GetZZZHlistActivity.this.isRefesh = false;
        LogUtils.e(GetZZZHlistActivity.this.TAG, "mPullRefreshListView加载");
        if (GetZZZHlistActivity.this.isEnd)
          UiUtil.showToast(GetZZZHlistActivity.this.context, "暂无更多数据");
        GetZZZHlistActivity localGetZZZHlistActivity = GetZZZHlistActivity.this;
        localGetZZZHlistActivity.page = (1 + localGetZZZHlistActivity.page);
        GetZZZHlistActivity.this.getzzzhList();
      }
    });
    this.mPullRefreshListView.setOnLastItemVisibleListener(new PullToRefreshBase.OnLastItemVisibleListener()
    {
      public void onLastItemVisible()
      {
        LogUtils.d(GetZZZHlistActivity.this.TAG, "End of List!");
      }
    });
    SoundPullEventListener localSoundPullEventListener = new SoundPullEventListener(this);
    localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.PULL_TO_REFRESH, 2131034114);
    localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.RESET, 2131034116);
    localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.REFRESHING, 2131034115);
    getzzzhList();
    if (this.adapter == null)
    {
      if ("1".equals(this.Ctype))
        this.adapter = new ZZZHListAdapter(this.context, this.result, "1");
      if (("2".equals(this.Ctype)) || ("3".equals(this.Ctype)))
        this.adapter = new ZZZHListAdapter(this.context, this.result, "2");
    }
    this.mPullRefreshListView.setAdapter(this.adapter);
  }

  private void refeshgetzzzzhList()
  {
    this.page = 1;
    HashMap localHashMap = new HashMap();
    localHashMap.put("memberid", this.memberid);
    localHashMap.put("page", this.page);
    localHashMap.put("Pagesize", "10");
    localHashMap.put("Ctype", this.Ctype);
    LogUtils.e(this.TAG, "getzzzhList(),page:" + this.page);
    LogUtils.e(this.TAG, "refeshgetzzzzhList()  Ctype:" + this.Ctype);
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_ZZZHLIST);
    RequestNet.get(this.context, AppConstants.URL_GET_ZZZHLIST, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        GetZZZHlistActivity.this.mPullRefreshListView.onRefreshComplete();
        LogUtils.e(GetZZZHlistActivity.this.TAG, "获取失败,refeshgetzzzzhList-result:" + paramAnonymousException);
        GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
      }

      public void onResponse(String paramAnonymousString)
      {
        GetZZZHlistActivity.this.mPullRefreshListView.onRefreshComplete();
        LogUtils.d(GetZZZHlistActivity.this.TAG, "result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
        {
          LogUtils.d(GetZZZHlistActivity.this.TAG, "result:" + paramAnonymousString);
          GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
        }
        ArrayList localArrayList;
        do
        {
          GetZZZHlistBean localGetZZZHlistBean;
          do
          {
            return;
            Gson localGson = new Gson();
            try
            {
              localGetZZZHlistBean = (GetZZZHlistBean)localGson.fromJson(paramAnonymousString, GetZZZHlistBean.class);
              LogUtils.d(GetZZZHlistActivity.this.TAG, "获取投注记录result:" + paramAnonymousString);
              if (localGetZZZHlistBean == null)
              {
                LogUtils.e(GetZZZHlistActivity.this.TAG, "getzzzhList == null，获取失败");
                GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
                return;
              }
            }
            catch (Exception localException)
            {
              while (true)
              {
                localException.printStackTrace();
                localGetZZZHlistBean = null;
              }
              if (localGetZZZHlistBean.getFlag() == -4)
              {
                GetZZZHlistActivity.activityStack.backToMain(MainActivity.class, GetZZZHlistActivity.this.context);
                return;
              }
              if (localGetZZZHlistBean.getFlag() == 0)
              {
                GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
                return;
              }
              if (localGetZZZHlistBean.getFlag() == -2)
              {
                GetZZZHlistActivity.this.showDownWireDialog();
                return;
              }
              if (localGetZZZHlistBean.getFlag() == -3)
              {
                GetZZZHlistActivity.this.ShowFengjinDialog();
                return;
              }
            }
          }
          while (localGetZZZHlistBean.getFlag() != 1);
          localArrayList = localGetZZZHlistBean.getResult();
          if (GetZZZHlistActivity.this.result != null)
            GetZZZHlistActivity.this.result.clear();
        }
        while (localArrayList == null);
        GetZZZHlistActivity.this.result.addAll(localArrayList);
        if (GetZZZHlistActivity.this.result.size() == 0)
          GetZZZHlistActivity.this.mPullRefreshListView.setEmptyView(GetZZZHlistActivity.this.emptyView);
        LogUtils.e(GetZZZHlistActivity.this.TAG, "result.size():" + GetZZZHlistActivity.this.result.size());
        GetZZZHlistActivity.this.adapter.setData(GetZZZHlistActivity.this.result);
        GetZZZHlistActivity.this.adapter.notifyDataSetChanged();
      }
    });
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903099);
    this.context = this;
    Intent localIntent = getIntent();
    this.Ctype = localIntent.getStringExtra("Ctype");
    this.id = localIntent.getIntExtra("id", 0);
    this.mPayTypeBean = ((PayTypeBean)localIntent.getSerializableExtra("payTypeBean"));
    LogUtils.e(this.TAG, "Ctype1:" + this.Ctype);
    if ("1".equals(this.Ctype))
      this.title = "选择银行帐号";
    while (true)
    {
      setTitle(8, 0, 2130837809, this.title, 0, 8, 8, 0, true);
      init();
      this.emptyView = LayoutInflater.from(this.context).inflate(2130903139, null);
      return;
      if ("2".equals(this.Ctype))
        this.title = "选择支付宝帐号";
      else if ("3".equals(this.Ctype))
        this.title = "选择微信帐号";
      else
        this.title = "选择微信帐号";
    }
  }

  protected void onResume()
  {
    super.onResume();
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabChongZhi.GetZZZHlistActivity
 * JD-Core Version:    0.6.2
 */